package consts

import "github.com/go-kratos/kratos/v2/errors"

type ResponseErrorV2 struct {
	Code            int    `json:"code"`
	BusinessCode    int    `json:"business_code"`
	InternalMsg     string `json:"internal_message"`
	ExternalMessage string `json:"message"`
}

// New returns an error object for the code, message.
func New(code int, reason, message string, mp map[string]string) *errors.Error {
	return &errors.Error{
		Status: errors.Status{
			Code:     int32(code),
			Message:  message,
			Reason:   reason,
			Metadata: mp,
		},
	}
}
